﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using QLTV_BLL;
using QLTV_Public;

namespace QLTV_GiaoDien
{
    public partial class uc_TimKiemDocGia : DevExpress.XtraEditors.XtraUserControl
    {
        public uc_TimKiemDocGia()
        {
            InitializeComponent();
        }
        TimKiem_BLL timkiem_bll = new TimKiem_BLL();
        private void btnTimKiem_Click(object sender, EventArgs e)
        {
            DocGia_Public dg = new DocGia_Public();
            
            
            //if (txt_MaDocGia.Text != "")
            //{
            //    dg.MaDocGia = int.Parse("0" + txt_MaDocGia.Text);
            //    gridControl1.DataSource = timkiem_bll.TimKiem_maDocGia(dg);
            //}
            if (txt_TenDocGia.Text != "")
            {
                dg.HoVaTen = txt_TenDocGia.Text;
                gridControl1.DataSource = timkiem_bll.TimKiem_tenDocGia(dg);
            }
        }

        private void txt_MaDocGia_TextChanged(object sender, EventArgs e)
        {
            btnTimKiem_Click(sender,e);
        }

        private void txt_TenDocGia_TextChanged(object sender, EventArgs e)
        {
            btnTimKiem_Click(sender,e);
        }

        private void btnHuy_Click(object sender, EventArgs e)
        {
            //txt_MaDocGia.ResetText();
            txt_TenDocGia.ResetText();
            
        }

        private void txt_MaDocGia_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsControl(e.KeyChar) && !Char.IsDigit(e.KeyChar))
                e.Handled=true;
        }
    }
}
